import java.io.*;
import java.util.*;
import java.lang.*;

public class Three {
	public static void main(String[] args) {
		int largest=0;
		long n=600851475143l;
		double c=Math.sqrt(n);
		for (int i=2;i<c;i++) {
			if (n%i==0) {
				if (i>largest) {largest=i;} 
				n=n/i;
			}
		}
		System.out.println(largest);
	}
}